package com.example.pattern.singleton;

public class TestSingleton {

    public static void main(String[] args) {

        Singleton singleton1 = Singleton.getInstance();
        Singleton singleton2 = Singleton.getInstance();

        if(singleton1 == singleton2){
            System.out.println("singleton1和singleton2====是同一个实例");
        }else{
            System.out.println("singleton1和singleton2====不是同一个实例");
        }

        Singleton2 singleton3 = Singleton2.getInstance();
        Singleton2 singleton4 = Singleton2.getInstance();

        if(singleton3 == singleton4){
            System.out.println("singleton3和singleton4====是同一个实例");
        }else{
            System.out.println("singleton3和singleton4====不是同一个实例");
        }

    }

}
